home *** CD-ROM | disk | FTP | other *** search
/ Dr. Windows 3 / dr win3.zip / dr win3 / PROGRAMR / UPC12BS1.ZIP / LIB / CONFIGUR.C < prev    next >
C/C++ Source or Header  |  1993-09-29  |  33KB  |  885 lines

  1. /*--------------------------------------------------------------------*/
  2. /*    c o n f i g u r . c                                             */
  3. /*                                                                    */
  4. /*    Support routines for UUPC/extended                              */
  5. /*                                                                    */
  6. /*    Changes Copyright 1990, 1991 (c) Andrew H. Derbyshire           */
  7. /*                                                                    */
  8. /*    History:                                                        */
  9. /*       21Nov1991 Break out of lib.c                          ahd    */
  10. /*--------------------------------------------------------------------*/
  11.  
  12. /*--------------------------------------------------------------------*/
  13. /*    Changes Copyright (c) 1989-1993 by Kendra Electronic            */
  14. /*    Wonderworks.                                                    */
  15. /*                                                                    */
  16. /*    All rights reserved except those explicitly granted by the      */
  17. /*    UUPC/extended license agreement.                                */
  18. /*--------------------------------------------------------------------*/
  19.  
  20. /*--------------------------------------------------------------------*/
  21. /*                          RCS Information                           */
  22. /*--------------------------------------------------------------------*/
  23.  
  24. /*
  25.  *    $Id: configur.c 1.22 1993/09/29 23:29:56 ahd Exp $
  26.  *
  27.  *    Revision history:
  28.  *    $Log: configur.c $
  29.  *     Revision 1.22  1993/09/29  23:29:56  ahd
  30.  *     Add xqtrootdir for UUXQT
  31.  *
  32.  *     Revision 1.21  1993/09/29  04:49:20  ahd
  33.  *     Move priority variables to modem file
  34.  *
  35.  *     Revision 1.20  1993/09/24  03:43:27  ahd
  36.  *     Use positive defaults for unsigned priority values
  37.  *
  38.  *     Revision 1.19  1993/09/20  04:38:11  ahd
  39.  *     TCP/IP support from Dave Watt
  40.  *     't' protocol support
  41.  *     OS/2 2.x support
  42.  *
  43.  *     Revision 1.18  1993/07/31  16:22:16  ahd
  44.  *     Changes in support of Robert Denny's Windows 3.x support
  45.  *
  46.  *     Revision 1.17  1993/07/22  23:19:50  ahd
  47.  *     First pass for Robert Denny's Windows 3.x support changes
  48.  *
  49.  *     Revision 1.16  1993/07/05  14:45:29  ahd
  50.  *     Correct message-of-the-day variable name
  51.  *     Correct WIN32 prefix support
  52.  *
  53.  *     Revision 1.15  1993/06/16  04:03:25  ahd
  54.  *     Special case root directories for UUPC/extended variable default
  55.  *
  56.  *     Revision 1.14  1993/06/15  12:18:06  ahd
  57.  *     Saved changed directory name for debugging
  58.  *
  59.  *     Revision 1.13  1993/05/30  15:25:50  ahd
  60.  *     Multiple driver support
  61.  *
  62.  *     Revision 1.12  1993/05/29  15:19:59  ahd
  63.  *     Add systems file, passwd files
  64.  *
  65.  *     Revision 1.11  1993/05/09  03:49:21  ahd
  66.  *     Support banner, motd strings
  67.  *     Support longname, honordebug, senddebug options
  68.  *
  69.  *     Revision 1.10  1993/04/15  03:17:21  ahd
  70.  *     Add bounce system option
  71.  *
  72.  *     Revision 1.9  1993/04/11  00:31:31  dmwatt
  73.  *     Global edits for year, TEXT, etc.
  74.  *
  75.  *     Revision 1.8  1993/04/05  04:32:19  ahd
  76.  *     Set timezone, windows input mode in common routine
  77.  *
  78.  *     Revision 1.7  1993/04/04  04:57:01  ahd
  79.  *     Default configuration directory from UUPCSYSRC
  80.  *     Default system directories from Configuration directory
  81.  *
  82.  *     Revision 1.6  1993/03/06  22:48:23  ahd
  83.  *     Don't fall off end of shorter tables
  84.  *
  85.  *     Revision 1.5  1993/01/23  19:08:09  ahd
  86.  *     Add Windows/NT to allowed environments
  87.  *
  88.  * Revision 1.4  1992/12/01  04:37:03  ahd
  89.  * Add SpeedOverMemory
  90.  *
  91.  * Revision 1.3  1992/11/22  20:58:55  ahd
  92.  * Normalize directories as read
  93.  * Use strpool to allocate const strings
  94.  *
  95.  * Revision 1.2  1992/11/19  02:56:47  ahd
  96.  * drop rcsid
  97.  *
  98.  * Revision 1.1  1992/11/16  05:00:26  ahd
  99.  * Initial revision
  100.  *
  101.  */
  102.  
  103.  
  104. #include <stdio.h>
  105. #include <stdlib.h>
  106. #include <string.h>
  107. #include <time.h>
  108. #include <ctype.h>
  109.  
  110. #ifndef __GNUC__
  111. #include <io.h>
  112. #endif
  113.  
  114. /*--------------------------------------------------------------------*/
  115. /*                    UUPC/extended include files                     */
  116. /*--------------------------------------------------------------------*/
  117.  
  118. #include "lib.h"
  119. #include "hlib.h"
  120. #include "timestmp.h"
  121. #include "pushpop.h"
  122.  
  123. /*--------------------------------------------------------------------*/
  124. /*                          Global variables                          */
  125. /*--------------------------------------------------------------------*/
  126.  
  127. currentfile();
  128.  
  129. boolean bflag[F_LAST];        /* Initialized to zero by compiler     */
  130.  
  131. char **E_internal = NULL;
  132. char *E_aliases = NULL;
  133. char *E_altsignature = NULL;
  134. char *E_anonymous = NULL;
  135. char *E_archivedir = NULL;
  136. char *E_backup = NULL;
  137. char *E_banner = NULL;
  138. char *E_charset = NULL;
  139. char *E_passwd  = NULL;
  140. char *E_systems = NULL;
  141. char *E_confdir = NULL;
  142. char *E_domain = NULL;
  143. char *E_editor = NULL;
  144. char *E_fdomain = NULL;
  145. char *E_filesent = NULL;
  146. char *E_homedir = NULL;
  147. char *E_inmodem = NULL;
  148. char *E_localdomain = NULL;
  149. char *E_mailbox = NULL;
  150. char *E_maildir = NULL;
  151. char *E_mailext = NULL;
  152. char *E_mailserv = NULL;
  153. char *E_motd = NULL;
  154. char *E_name = NULL;
  155. char *E_newsdir = NULL;
  156. char *E_newsserv = NULL;
  157. char *E_nodename = NULL;
  158. char *E_organization = NULL;
  159. char *E_pager = NULL;
  160. char *E_postmaster = NULL;
  161. char *E_pubdir = NULL;
  162. char *E_replyto = NULL;
  163. char *E_signature = NULL;
  164. char *E_spooldir = NULL;
  165. char *E_tempdir = NULL;
  166. char *E_uncompress = NULL;
  167. char *E_uuxqtpath = NULL;
  168. char *E_version = NULL;
  169. char *E_cwd = NULL;
  170. char *E_xqtRootDir = NULL;
  171. KEWSHORT E_maxhops = 20;                                    /* ahd */
  172. static char *dummy = NULL;
  173. static char *E_tz = NULL;
  174.  
  175. /*--------------------------------------------------------------------*/
  176. /*                       Local emumerated types                       */
  177. /*--------------------------------------------------------------------*/
  178.  
  179. typedef enum {
  180.       ENV_UNKNOWN    = 0x0001,
  181.       ENV_DOS        = 0x0002,
  182.       ENV_BIT32      = 0x0004,
  183.       ENV_BIT16      = 0x0008,
  184.       ENV_OS2        = 0x0010,
  185.       ENV_OS2_32BIT  = 0x0020,
  186.       ENV_OS2_16BIT  = 0x0040,
  187.       ENV_WIN        = 0x0080,
  188.       ENV_WIN_32BIT  = 0x0100,
  189.       ENV_WIN_16BIT  = 0x0200
  190.       } ENV_TYPE;
  191.  
  192. #ifdef WIN32
  193. static ENV_TYPE active_env = ENV_WIN_32BIT | ENV_WIN | ENV_BIT32;
  194. #elif defined(_Windows)
  195. static ENV_TYPE active_env = ENV_WIN_16BIT | ENV_WIN | ENV_BIT16;
  196. #elif defined(__OS2__)
  197. static ENV_TYPE active_env = ENV_OS2_32BIT | ENV_OS2 | ENV_BIT32;
  198. #else
  199. static ENV_TYPE active_env = ENV_DOS | ENV_BIT16;
  200. #endif
  201.  
  202. static boolean getrcnames(char **sysp,char **usrp);
  203.  
  204. /*--------------------------------------------------------------------*/
  205. /*  The following table controls the configuration files processing   */
  206. /*--------------------------------------------------------------------*/
  207.  
  208. static CONFIGTABLE envtable[] = {
  209.    {"aliases",      &E_aliases,      B_TOKEN|B_MUA},
  210.    {"altsignature", &E_altsignature, B_TOKEN|B_MUA},
  211.    {"anonymouslogin", &E_anonymous,  B_GLOBAL|B_TOKEN|(B_ALL & ~ B_MAIL)},
  212.    {"archivedir",   &E_archivedir,   B_GLOBAL|B_PATH|B_ALL},
  213.    {"backupext",    &E_backup,       B_TOKEN|B_MUA},
  214.    {"banner",       &E_banner,       B_GLOBAL|B_PATH|B_UUCICO},
  215.    {"charset",      &E_charset,      B_TOKEN|B_GLOBAL|B_SPOOL},
  216.    {"confdir",      &E_confdir,      B_GLOBAL|B_PATH|B_ALL},
  217.    {"domain",       &E_domain,       B_REQUIRED|B_GLOBAL|B_TOKEN|B_ALL},
  218.    {"editor",       &E_editor,       B_STRING|B_MUA|B_NEWS},
  219.    {"filesent",     &E_filesent,     B_TOKEN|B_MUA|B_NEWS},
  220.    {"folders",      &dummy,          B_PATH|B_MUSH },
  221.    {"fromdomain",   &E_fdomain,      B_GLOBAL|B_MAIL|B_NEWS|B_TOKEN},
  222.    {"home",         &E_homedir,      B_PATH|B_REQUIRED|B_ALL},
  223.    {"inmodem",      &E_inmodem,      B_GLOBAL|B_TOKEN|B_UUCICO},
  224.    {"internalcommands", (char **)   &E_internal, B_GLOBAL|B_LIST|B_ALL},
  225.    {"localdomain",  &E_localdomain,  B_GLOBAL|B_TOKE